package com.zqu.controller;

import com.zqu.pojo.Insurance;
import com.zqu.service.InsuranceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("insurance")
public class InsuranceController {

    @Autowired
    private InsuranceService insuranceService;

    @RequestMapping("findinsurance")
    @ResponseBody
    public Insurance selectById(){
        return insuranceService.selectInsuranceById(1);
    }

    @RequestMapping("selectlist")
    @ResponseBody
    public List<Insurance> selectlist(){
        return insuranceService.selectList(new Insurance());
    }

    @RequestMapping("insertinsurance")
    @ResponseBody
    public boolean insert(){
        return insuranceService.insertInsurance(new Insurance());
    }

    @RequestMapping("updateinsurance")
    @ResponseBody
    public boolean update(){
        return insuranceService.updateInsurance(new Insurance());
    }

    @RequestMapping("deleteinsurance")
    @ResponseBody
    public boolean delete(){
        return insuranceService.deleteInsurance(1);
    }

    @RequestMapping("deleteinsurancebyids")
    @ResponseBody
    public boolean deletebyids(){
        String[] ids = {"1","2"};
        return insuranceService.deleteInsuranceByIds(ids);
    }
}
